-- @owner: opentestcase027
-- @date: 2022/6/9
-- @testpoint: ceil函数结合case when条件的使用

--step1:建表 expect:建表成功
drop table if exists t_ustore_ceil_0032;
create table t_ustore_ceil_0032(
col_1 decimal,
col_2 int ,
col_3 float8,
col_4 decimal(6,2)
) with (storage_type=ustore);
 
--step2:创建序列 expect:序列创建成功
drop sequence if exists seq_ustore_ceil_0032;
create sequence seq_ustore_ceil_0032 increment by 1 start with 100000;
 
--step3:循环插入1000条数据 expect:插入成功
begin
 for i in 1..1000 loop
      insert into t_ustore_ceil_0032 values(
   3.1415926+seq_ustore_ceil_0032.nextval,
   i,
   1.0e+100,
   i+445.255
   );
    end loop;
end;
/

--step4:ceil函数结合case when的使用 expect:查询结果为a
select case when ceil(-99.999)=-99 then 'a' else 'b' end from t_ustore_ceil_0032 order by 1 limit 1;

--step5:清理环境 expect:清理成功
drop table if exists t_ustore_ceil_0032;
drop sequence if exists seq_ustore_ceil_0032;